<template>
	<view class="list page bgf6 c00">

		<scroll-view scroll-y="true" class="list" @scrolltolower="nextPage">

			<view class="bgff flex flexC flexB aliC rel r7 py20 mt16 mx12 shadow">
				<view class="flex1 borr">
					<view class="bold6 fs20">{{totalAmount}}元</view>
					<view class="c85 mb8">总营业额</view>
				</view>
				<view class="flex1 borr">
					<view class="bold6 fs20">{{payAmount}}元</view>
					<view class="c85 mb8">小程序支付额</view>
				</view>
			</view>

			<view v-for="item in list">



				<view class="bgff mx12 mt16 py20 px14">
					<view class="flex flexC mb6">
						<text class="flex1">月份：{{item.date}}</text>
						<text class="flex1 ml20">金额：{{item.amount}}</text>
					</view>

				</view>
			</view>
		</scroll-view>
		<tabbar></tabbar>


	</view>
</template>

<script>
	export default {
		data() {
			return {
				shopList: [],
				selectShop: null,
				page: 1,
				list: [],
				isLastPage: false,
				isnodata: false,
				payAmount: 0,
				totalAmount: 0,
				mobile: '',
				startTime: '开始时间',
				endTime: '结束时间',
				unAmount: 0

			};
		},
		onLoad(option) {

		
			this.selectShop = JSON.parse(uni.getStorageSync("selectShop"));
			this.getList();
		},
		methods: {

			dateStartChange(e) {
				this.startTime = e.detail.value;
				console.info(e);
			},
			dateEndChange(e) {
				this.endTime = e.detail.value;
			},


			searchList() {
				console.info('==mobile===' + this.mobile)
				this.page = 1;
				this.list = [];
				this.isnodata = false;
				this.isLastPage = false;
				this.getList();
			},

			nextPage() {
				if (this.isLastPage) return;
				this.page += 1;
				this.getList();
			},

			getList() {

				let param = {
					shop_id: this.selectShop.id,

				};
				let that = this;
				this.$api.investSummary(param).then(res => {
					if (res.code == 1) {
						that.totalAmount = res.data.totalAmount;
						that.payAmount = res.data.payAmount;
						that.list = res.data.date;

					} else {

					}
				})
			},

			onClose() {
				this.$refs.shopPicker.close();
			},
			getShopList() {
				let param = {
					keyword: this.keyword
				};
				let that = this;
				this.$api.getShopList(param).then(res => {

					console.info(JSON.stringify(res));
					if (res.code == 1) {
						that.shopList = res.data;
						if (that.shopList.length > 0) {

						}
					} else {

					}
				})
			},

			showShop() {
				this.$refs.shopPicker.open();

			},
			search(value) {

				this.keyword = value;
				this.getShopList();
			},

			onSelectShop(item) {
				this.selectShop = item;
				this.$refs.shopPicker.close();
				this.page = 1;
				this.list = [];
				this.isnodata = false;
				this.isLastPage = false;
				this.getList();
			},
		}
	}
</script>

<style lang="scss">
	.w100 {
		width: 160rpx;
	}
</style>